# -*- encoding=utf8 -*-
__author__ = "Simon"

from airtest.core.api import *
from poco.drivers.unity3d import UnityPoco
poco = UnityPoco()
using("../main.air")
import main

def dungeons2():
    #获取旋转后的分辨率
    x,y=device().get_current_resolution()
#     sleep(2)
#     main.judge_sheet(x,y)
#     sleep(2)
#     main.risk_entry(x,y)
#     sleep(2)
#     touch([0.91*x,0.25*y])
#     sleep(2)
#     if exists(Template(r"tpl1596794332583.png", threshold=0.9000000000000001, record_pos=(0.437, 0.176), resolution=(1280, 720))):
#         touch([0.73*x,0.45*y])
#         sleep(2)
#         main.cilck_blue_ok()
#         sleep(3)
    if 1:
        touch(Template(r"tpl1596794547675.png", record_pos=(0.175, 0.134), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.9*x,0.17*y])
        sleep(2)
        touch([0.83*x,0.32*y])
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(25)
        main.next_step()
        sleep(5)
        main.cilck_white_ok()
        sleep(2)
    #---------------------------------
        touch(Template(r"tpl1596796638320.png", record_pos=(-0.119, 0.028), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(25)
        main.next_step()
        sleep(5)
        main.cilck_white_ok()
        sleep(2)
        #---------------------------------
        touch(Template(r"tpl1596796775816.png", record_pos=(0.156, 0.02), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(25)
        main.next_step()
        sleep(5)
        main.cilck_white_ok()
        sleep(2)

        touch(Template(r"tpl1596796868502.png", record_pos=(-0.064, 0.028), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(25)
        main.next_step()
        sleep(5)
        main.cilck_white_ok()
        sleep(2)

        touch(Template(r"tpl1596796955531.png", record_pos=(-0.314, 0.033), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(25)
        main.next_step()
        sleep(5)
        main.cilck_white_ok()
        sleep(2)

        touch(Template(r"tpl1596796979675.png", record_pos=(0.075, -0.069), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(25)
        main.next_step()
        sleep(5)
        main.cilck_white_ok()
        sleep(2)

        touch(Template(r"tpl1596797004078.png", record_pos=(0.134, -0.037), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(30)
        main.next_step()
        sleep(5)
        main.cilck_white_ok()
        sleep(2)

        touch(Template(r"tpl1596797022521.png", record_pos=(-0.044, 0.012), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(30)
        main.next_step()
        sleep(5)
        main.cilck_white_ok()
        sleep(2)

        touch(Template(r"tpl1596797042934.png", record_pos=(-0.27, -0.11), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(30)
        main.next_step()
        sleep(5)
        main.cilck_white_ok()
        sleep(2)

        touch(Template(r"tpl1596797070986.png", record_pos=(0.201, -0.208), resolution=(1280, 720)))
        sleep(2)
        touch([0.88*x,0.84*y]) #挑战
        sleep(2)
        touch([0.88*x,0.84*y]) #战斗开始
        sleep(80)
        main.next_step()
        sleep(6)
        main.cilck_white_ok()
        sleep(5)
        touch([0.095*x,0.95*y])
        sleep(2)
    else:
        print("已经挑战过了")
        sleep(2)
        touch([0.095*x,0.95*y])
        sleep(2)
    sleep(2)
    touch([0.095*x,0.95*y])
# dungeons2()